{% extends "base.html" %}
{% block content %}
    <h2>编辑课程信息</h2>
    <form action="{{ url_for('edit_course', id=course.id) }}" method="post">
        <div class="form-group">
            <label for="name">课程名称:</label>
            <input type="text" class="form-control" id="name" name="name" value="{{ course.name }}" required>
        </div>
        <div class="form-group">
            <label for="teacher_id">教师姓名:</label>
            <select class="form-control" id="teacher_id" name="teacher_id" required>
                {% for teacher in teachers %}
                <option value="{{ teacher.id }}" {% if teacher.id == course.teacher_id %}selected{% endif %}>{{ teacher.username }}</option>
                {% endfor %}
            </select>
        </div>
        <br>
        <button type="submit" class="btn btn-primary">保存</button><br><br>
    </form>
    <a href="{{ url_for('list_courses') }}" class="btn btn-secondary">返回课程列表</a>
{% endblock %}
